package com.newlink.building.userinfo.mvp

import com.newlink.building.common_base.base.BasePresenter
import com.newlink.building.common_base.ext.ss
import com.newlink.building.common_base.utils.NLog
import com.newlink.building.common_base.utils.logDebug
import com.newlink.building.userinfo.mvp.contract.Module_UserInfo_FamilyManagementDetailActivationContract
import com.newlink.building.userinfo.mvp.model.Module_UserInfo_FamilyManagementDetailActivationModel

/**
 * @author wangyang
 * @date 2022/10/11
 * @description 我的——家庭管理——已激活状态的详情页页面的Presenter
 */
class Module_UserInfo_FamilyManagementDetailActivationPresenter :
    BasePresenter<Module_UserInfo_FamilyManagementDetailActivationContract.Model, Module_UserInfo_FamilyManagementDetailActivationContract.View>(),
    Module_UserInfo_FamilyManagementDetailActivationContract.Presenter {

    override fun createModel(): Module_UserInfo_FamilyManagementDetailActivationContract.Model? {
        return Module_UserInfo_FamilyManagementDetailActivationModel()
    }

    override fun deleteFamilyManagement(token: String, userId: String) {
        mModel?.deleteFamilyManagement(token, userId)?.ss(mModel, mView) {
            logDebug<Module_UserInfo_FamilyManagementDetailActivationPresenter>("deleteFamilyManagement response ->  ${it?.data}")
            if (it?.code == 200) {
                mView?.deleteFamilyManagementSuccess()
            } else {
                mView?.deleteFamilyManagementFail()
            }
        }
    }

    override fun deleteFamilyManagementFromKcp(token: String, ownerId: String, delUserId: String) {
        NLog.e("[jake].... deleteFamilyManagementFromKcp :: $token , $ownerId , $delUserId")
        mModel?.deleteFamilyManagementFromKcp(token, ownerId, delUserId)
    }

}